package bbalgae.swing;

import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JToolBar;

public class SwingToolBar extends JToolBar{

		private static SwingMenuActionL action = null;
		private String imgPath ="/images/toolbar/";
		private String imgExt=".png";
		
		public SwingToolBar() {
			action = new SwingMenuActionL();
			setFloatable(false);
			
			addToolBarButton();//툴바에 버튼추가
				}

		private void addToolBarButton() {
			add(makeTollBarButton("new", "새로만들기"));
			add(makeTollBarButton("close", "닫기"));
			add(makeTollBarButton("exit", "프로그램종료"));
			
		}
		private JButton makeTollBarButton(String img, String tooltip){
			JButton btn = new JButton();
			btn.setFocusPainted(false);
			btn.addActionListener(action);
			btn.setActionCommand(img);
			btn.setToolTipText(tooltip);
			
			URL  iconPath = getClass().getResource(imgPath+img+imgExt);
			btn.setIcon(new ImageIcon(iconPath));
			
			return btn;
}






























}
